<?php

namespace app\service;

class Redis extends \Redis
{
    public static function redis($db_select = 1)
    {
        $con = new \Redis();
        $con->connect(env('redis.host'), env('redis.port'), 5);
        if (env('redis.password') != '') {
            $con->auth(env('redis.password')); // 密码验证
        }
        $con->select($db_select); // 选择数据库
        return $con;
    }
}